﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Parafarmacia
{
    public partial class ImagenesGestion : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int ProdID = Convert.ToInt16(Request.QueryString["id"]);


        }

        /// <summary>
        /// Upload file
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        protected void butUpload_Click(object sender, EventArgs e)
        {
            UploadFile();
        }

        /// <summary>
        /// Upload file to server
        /// </summary>
        private void UploadFile()
        {

            if (FileUploadImg.HasFile)
            {
                try
                {
                    if (FileUploadImg.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUploadImg.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUploadImg.FileName);
                            FileUploadImg.SaveAs(Server.MapPath("~/") + filename);
                        }
                    }
                }
                catch
                { }

            }
        }
    }
}